#{extends 'main.html' /}

#{set title:'Liste de vos candidatures' /}
        
#{if candidatures}
    <div class="post">
        <div class="post">
            <h2 class="post-title">
                Liste de vos candidatures
            </h2>
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="liste"> 
        		<thead>
        			<tr>
        			    <th>Etat de votre candidature</th>
					<th>Role</th>
        				<th>Intitule</th>	
        				<th>Nature</th>
        				<th>Structure Organisatrice</th>
        				<th>Durée</th>
        				<th>Lieu</th>
						<th>Code stage</th>
        				<th>Date de Début</th>
        				<th>Condition de déroulement</th>
        				<th>Date de Fin</th>
        				<th>Date d'évaluation</th>
        				<th>Nombre de place disponible</th>
        				<th>Etat du stage</th>
        				<th>Détails</th>
        				<th>Demande Annulation</th>			
        			</tr>
        		</thead>		

                <tbody>
        	    #{list items:candidatures, as:'candidature' }
        	       <tr>
        	           
        	           <td> 
                           ${candidature.etatCandid}
       	               </td>
       	               
			           <td> 
                           ${candidature.role.nom}
       	               </td>

        	            <td> 
                            ${candidature.stage.intitule}
        	            </td>
        	            
        	            <td> 
                            ${candidature.stage.nature}
        	            </td>
        	            
        	            <td> 
                            ${candidature.stage.structure}
        	            </td>
        	            
        	            <td> 
                            ${candidature.stage.duree} Jour(s)
        	            </td>
        	            
        	                <td> 
                            #{if candidature.stage.lieu == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${candidature.stage.lieu}
                            #{/else}
        	            </td>
        	            <td>
						${candidature.getStage().getCode()}
						</td>
        	            <td> 
                            #{if candidature.stage.dateDeb == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${candidature.stage.dateDeb.format('dd MMMM yyyy', 'fr')}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if candidature.stage.modalites == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${candidature.stage.modalites}
                            #{/else}
        	            </td>
        	            
        	            
        	            <td> 
                            #{if candidature.stage.dateFin == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${candidature.stage.dateFin.format('dd MMMM yyyy', 'fr')}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if candidature.stage.dateExam == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${candidature.stage.dateExam.format('dd MMMM yyyy', 'fr')}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if candidature.stage.effectif == null}
                                -
        	                #{/if}
                            #{else}
                            #{if !(candidature.stage.effectifMax == null)}
        	                    ${(candidature.stage.effectifMax)-(candidature.stage.effectif)}
        	                #{/if}
                            #{/else}
        	            </td>
        	            
        	            <td> 
        	                ${candidature.stage.etat}
        	            </td>
        	            <td>
        	                 <a href="@{Stages.detailStage(candidature.stage.id)}">Détails</a>
        	            </td>
        	            <td>
            	            #{if candidature.candidature_non_annuler == true}
            	                Annulation refusée
            	            #{/if}
            	            #{else}
            	                #{if candidature.etatCandid.numEtat ==7 }
            	                -
            	                #{/if}
            	                #{else}
        	                    <a href="@{Candidats.demandeAnnulation(candidature.stage.id)}">Demande d'annulation</a>
            	                #{/else}
            	            #{/else}
        	            </td>
        	       </tr>
        	    #{/list}
        	    </tbody>
        	</table>
        </div>
    </div>    
#{/if}
 
#{else}
    <div class="empty">
        Vous n'avez pas de candidatures en cours.
    </div>
#{/else}
